import 'package:flutter/cupertino.dart';
import 'package:get/get.dart';
import 'package:yt_devops/components/gaps.dart';
import 'package:yt_devops/components/log_utils.dart';
import 'package:yt_devops/components/yt_text_style.dart';
import 'package:yt_devops/components/my_gesture_detector.dart';
import 'package:yt_devops/resources/str_res_keys.dart';
import 'package:yt_devops/styles/styles.dart';

/**
 *
 * @Description TODO
 * @Author liuer
 * @CreateTime 2024年03月21日 10:59
 */

class AlarmTaskTab extends StatelessWidget {
  int selectedIndex;
  String firstTitle;
  String secondTitle;
  final Function(int) callBack;
  final Color textColor;
  final Color unSelectedTextColor;
   AlarmTaskTab(this.selectedIndex,this.callBack,{ required this.firstTitle ,
     required this.secondTitle,this.textColor = Colour.mainTextColor,
     this.unSelectedTextColor = Colour.otherTextColor,
     super.key});

  @override
  Widget build(BuildContext context) {
    Log.d('AlarmTaskTab=');

    return SizedBox(
      height: 44,
      child: Row(
        children: [
          MyGestureDetector(onTap: () {

            selectedIndex = 0;
            callBack(selectedIndex);

          }, child: Text(
            firstTitle.tr,
            style: ytTextStyle(
                fontSize: selectedIndex == 0?24:16,
                fontWeight: FontWeight.w500,
                color: selectedIndex == 0
                    ? textColor
                    : unSelectedTextColor),
          )),
          Gaps.hGap20,
          MyGestureDetector(onTap: () {
            selectedIndex = 1;
            callBack(selectedIndex);
          }, child: Text(
            secondTitle.tr,
            style: ytTextStyle(
                fontSize: selectedIndex == 1?24:16,
                fontWeight: FontWeight.w500,
                color: selectedIndex == 1
                    ? textColor
                    : unSelectedTextColor),
          )),
        ],
      ),
    );
  }
}

